package com.huak.web.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author LR2SD
 * @description
 * @date 2019-04-20 14:47
 */

@ControllerAdvice(assignableTypes = HelloWorldController.class)
public class HelloWorldControllerAdvice {



    @ModelAttribute("message")
    public String hello(@RequestHeader("Accept-Language")String acceptLanguage){
        System.out.println("model---"+acceptLanguage);
        return "liuhuan1234";
    }

    @ExceptionHandler(Throwable.class)
    public ResponseEntity<String> onException(Throwable throwable){
        return ResponseEntity.ok(throwable.getMessage());
    }
}
